package com.hyc.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hyc.commons.base.BaseController;
import com.hyc.commons.utils.StringUtils;
import com.hyc.model.User;
import com.hyc.model.vo.UserVo;
import com.hyc.service.UserService;

@Controller
@RequestMapping("admin/user/")
public class UserController extends BaseController{
	
	@Resource
	private UserService userService;
			
    @RequestMapping("/logincheck")
	public String loginIndex(){   	
		return "index";
	}
    
    @RequestMapping("addUser")
   	public String registIndex(){  
    	
   		return "admin/user/userAdd";
   	}
    
    @RequestMapping("userAdd")
    @ResponseBody
    public Object addUserName(String loginName,String name){
//    	String loginName=request.getParameter("loginName");
    	System.out.println("****************"+loginName+"*****************************");  
    	System.out.println("****************"+name+"*****************************");
		return renderSuccess("添加成功");    	
    }
    
//    @RequestMapping("userAdd")
//    @ResponseBody
//    public Object insertUser(UserVo userVo){
//    	List<User> userList=userService.selectByLoginName(userVo);
//    	if(userList!=null&&userList.size()>0){
//    		return renderError("登录名已存在!");
//    	}
//    	//加盐
//    	//String salt=StringUtils.getUUid();
//    	
//    	int state=userService.insertUser(userVo);
//    	if(state==-1){
//    		return renderError("添加失败");
//    	}
//		return renderSuccess("添加成功");
//    	
//    }
    
    @RequestMapping("doEasyUI")
    public String getEasyUI(){
    	return "easyuiDemo/demo1";
    }
}
